package com.cj;

import com.cj.consumer.RoleService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author cc
 * @date 2025-05-13 14:46
 **/

public class Demo03 {

    public static void main(String[] args) {
        // service 里面注册 controller 会报错，，， 一个在spring容器，一个在springmvc容器，，，
        ClassPathXmlApplicationContext parent = new ClassPathXmlApplicationContext("beans-merchant.xml");
        ClassPathXmlApplicationContext child = new ClassPathXmlApplicationContext("beans-consumer.xml");

        child.setParent(parent);

        // 重新构建一下
        child.refresh();


        RoleService c = child.getBean(RoleService.class);
        System.out.println("c = " + c);

        com.cj.merchant.RoleService m = child.getBean(com.cj.merchant.RoleService.class);
        System.out.println("m = " + m);

    }
}
